/**
 * 
 */
package twitter;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import opennlp.tools.postag.POSModel;
import opennlp.tools.postag.POSTaggerME;

/**
 * @author Fernando
 *
 */
public class EtiquetaPalabras {
	
	private POSTaggerME etiquetador;
	
	public EtiquetaPalabras(String modelo) throws FileNotFoundException{
		InputStream modelIn = new FileInputStream(modelo);
		 
		try{
			POSModel model = new POSModel(modelIn);
			etiquetador = new POSTaggerME(model);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if(modelIn != null){
				try{
					modelIn.close();
				}catch(IOException e){}
			}
		}
	}
	
	public String[] etiquetar(String[] tokens){
		return etiquetador.tag(tokens);
	}

}
